/*
 * Copyright (c) 2010 The Chromium Authors. All rights reserved.  Use of this
 * source code is governed by a BSD-style license that can be found in the
 * LICENSE file.
 */

//check if page contains video tag.
if (document.getElementsByTagName("video").length > 0) {
  // 
  chrome.extension.sendRequest({}, function(response) {});
} else {
  // No video tag was found.
}

chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
 var videos = document.getElementsByTagName("video");
 if (request.action == "playVideo")
  videos[0].play();
 else if (request.action == "pauseVideo")
  for (var i = 0, video; video = videos[i]; i++)
	video.pause();
 else {
 }
 sendResponse({}); // Send nothing..
});
